import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;

public class ProcessSystem {
    static HashMap<String, Semaphore> semaphoreHashMap = new HashMap<>();

    private int processID;
    //任务列表-
    private List<Process> taskList = new LinkedList<>();
    //就绪队列-内存
    private List<Process> readyList = new LinkedList<>();
    //任务池-磁盘
    private List<Process> processPool = new LinkedList<>();

    private static final ProcessSystem processSystem = new ProcessSystem();

    private ProcessSystem() {
    }

    public static ProcessSystem getProcessSystem() {
        return processSystem;
    }

    public Process createProcess(Process father, int IOTimeZone, int CPUTimeZone, List<WorkUnit> workUnitList, int size) {

        DataBlock dataBlock = MemorySystem.getMemorySystem().malloc(processID);
        Process newProcess = new Process(father, IOTimeZone, CPUTimeZone, workUnitList, processID, dataBlock.getStartLocation(), size);
        processID++;
        return newProcess;
    }
}
